package com.snap.vseries.fragment;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.snap.vseries.R;
import com.snap.vseries.adapter.RunningProcessAdapter;
import com.snap.vseries.base.BaseFragment;
import com.snap.vseries.bean.ExpInfo;

import butterknife.BindView;

@SuppressLint("ValidFragment")
public class DetailLogFragment extends BaseFragment {

    @BindView(R.id.rec)
    RecyclerView rec;

    private ExpInfo experimentInfo;

    public DetailLogFragment(ExpInfo experimentInfo) {
        this.experimentInfo = experimentInfo;
    }

    @Override
    protected int layoutResId() {
        return R.layout.fragment_detail_log;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        if (experimentInfo == null || experimentInfo.getProcessData() == null) {
            return;
        }
        RunningProcessAdapter adapter = new RunningProcessAdapter(experimentInfo.getProcessData());
        rec.setLayoutManager(new LinearLayoutManager(getContext()));
        rec.setAdapter(adapter);
    }
}